<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Progma" content="no-cache" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/mm_training.css" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/user.css" type="text/css" />
<link type="text/css" href="<%=request.getContextPath() %>/css/smoothness/jquery-ui-1.7.1.custom.css" rel="stylesheet"/>
<script type="text/javascript" src="<%=request.getContextPath() %>/scripts/jquery/jquery-1.3.2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/scripts/jquery/jquery-ui-1.7.1.custom.js"></script>
<script type="text/javascript">

	/**
	 * 广告操作(上线,下线,删除)
	 *
	 * @param adID 广告ID 
	 * @param action 操作执行ACTION名称
	 * @param message 操作失败时消息
	 *
	 */
	function advertisementOperation(adID, action, message) {
		var context = "<%=request.getContextPath()%>";
		var URL = context + "/manage/" + action + ".do";
		// 提交請求
		$.ajax({
			   url: URL,
			   data: "advertisementID=" + adID,
			   dataType:"html",
			   success: function (data) {
				   // 獲取返回消息 
				   var returnMessage = $("#returnMessage", data);
				   if (returnMessage.length > 0) {
						var messageBox = $("<div></div>");
						var content = returnMessage.text();
						if ("error" == content) {
							$("<div>" + message + "</div>").dialog({
								title : '失败......',
								resizable:false,
								draggable:false,
								close :function (event) {
									$(this).dialog("destroy");
								}
							});
							return ;
						} 
						messageBox.html(content);
						messageBox.dialog({
							title:content,
							resizable:false,
							draggable:false,
							close : function (event) {
								$(this).dialog("destroy");
								//window.location.reload(true);
							}
						});
				   } else {
					   document.location.href = context + "/error.jsp?random=" + Math.random();
				   }
			   },
		   	   error: function (data) {
			   	   document.location.href = context + "/error.jsp?random=" + Math.random();
			   }
		});
	}
</script>
<style type="text/css">
	.err_msg {
		color: red;
		font-size: 12px;
	}
	#individualForm td {
		font-size: 12px;
		white-space: nowrap;
	}
	body {
		font-size: 12px;
	}
	.pageName {
		font-size: 15px;
	}
</style>
<title>广告管理</title>
</head>
<body bgcolor="#64748B">
<jsp:include page="/head.jsp"></jsp:include>
	<td width="230" valign="top" bgcolor="#26354a"><br/>
		<table width="230" cellspacing="0" cellpadding="0" border="0">
			<tbody>
				<tr>
				<td width="230" id="padding" class="sidebarText">广告管理<br/>
				</tr>		
				<tr>
				<td width="230" id="padding" class="sidebarText">
				</td>
				</tr>
				<tr>
				<td width="230" id="padding" class="sidebarText">
				</td>
				</tr>
			</tbody>
		</table>	
	</td>
	<td width="100%" valign="top" colspan="3">
		<table width="440" cellspacing="0" cellpadding="0" border="0">
			<tbody>
			<tr>
				<td class="pageName" colspan="2"><p>正在線上的關鍵字廣告:</p></td>
			</tr>
			<tr>
				<td>2</td>
				<td><a style="cursor: pointer;" onclick="advertisementOperation('id', 'stopPlayKeywords', '停止播放关键字广告失败');">停止播放</a></td>
			</tr>		
			</tbody>
		</table>
		<table width="440" cellspacing="0" cellpadding="0" border="0">
			<tbody>
			<tr>
				<td class="pageName" colspan="2"><p>已經下線的關鍵字廣告:</p></td>
			</tr>
			<tr>
				<td>2</td>
				<td><a style="cursor: pointer;" onclick="advertisementOperation('id', 'onlinePlayKeywords', '上线播放关键字广告失败');">上线播放</a></td>
				<td><a style="cursor: pointer;" onclick="advertisementOperation('id','deleteKeywords', '删除关键字广告失败');">删除</a></td>
			</tr>		
			</tbody>
		</table>
		<table width="440" cellspacing="0" cellpadding="0" border="0">
			<tbody>
			<tr>
				<td class="pageName" colspan="2"><p>正在線上的超連接廣告:</p></td>
			</tr>
			<tr>
				<td>2</td>
				<td><a style="cursor: pointer;" onclick="advertisementOperation('id', 'stopPlayHyperlink', '停止播放超連接广告失败');">停止播放</a></td>
			</tr>		
			</tbody>
		</table>
		<table width="440" cellspacing="0" cellpadding="0" border="0">
			<tbody>
			<tr>
				<td class="pageName" colspan="2"><p>已經下線的超鏈接廣告:</p></td>
			</tr>
			<tr>
				<td>2</td>
				<td><a style="cursor: pointer;" onclick="advertisementOperation('id', 'onlinePlayHyperlink', '上线播放超連接广告失败');">上线播放</a></td>
				<td><a style="cursor: pointer;" onclick="advertisementOperation('id', 'deleteHyperlink', '删除超連接广告失败');">删除</a></td>
			</tr>		
			</tbody>
		</table>
	</td>
<jsp:include page="/footer.jsp"></jsp:include>
</body>
</html>